<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Entity.*"%>
<%@page import="Dao.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
		String launcher_id = "";
		if (session.getAttribute("loginedsession") != null) {
			launcher_id = session.getAttribute("loginedsession").toString();
		}

		List<Task> task_list = new ArrayList<Task>();

		if (session.getAttribute("myLaunchedTask_session") != null) {
			task_list = (List) session.getAttribute("myLaunchedTask_session");
			session.removeAttribute("myLaunchedTask_session");
		}
	%>
	<h1>发布任务</h1>

	<link href="<%=request.getContextPath()%>/css/backstage.css"
		rel="stylesheet" type="text/css" />

	<div class="header">
		<font size="6" color="#62A8EA"><br />&emsp;&emsp;&emsp;发布任务</font>
	</div>

	<div class="body">
		<form action="../../TaskControl/launchTask" method="post"
			enctype="multipart/form-data" name="launchTask_form">
			<table class="dataintable">
				<tr>
					<td align="center">发布者ID：</td>
					<td colspan="6"><input type="text" value=<%=launcher_id%>
						name="launcher_id" readonly></td>
				</tr>
				<tr>
					<td align="center">发布者姓名：</td>
					<td colspan="6"><input type="text" name="launcher_name"></td>
				</tr>
				<tr>
					<td align="center">任务标题</td>
					<td colspan="6"><input type="text" name="taskname"></td>
				</tr>
				<tr>
					<td align="center">任务内容：</td>
					<td colspan="6"><textarea name="taskcontent" rows="6"
							cols="50"></textarea></td>
				</tr>
				<tr>
					<td align="center">开始时间：</td>
					<td><input type="text" name="startTimeYear"></td>
					<td>年</td>
					<td><input type="text" name="startTimeMonth"></td>
					<td>月</td>
					<td><input type="text" name="startTimeDay"></td>
					<td>日</td>
				</tr>
				<tr>
					<td align="center">结束时间：</td>
					<td><input type="text" name="endTimeYear"></td>
					<td>年</td>
					<td><input type="text" name="endTimeMonth"></td>
					<td>月</td>
					<td><input type="text" name="endTimeDay"></td>
					<td>日</td>
				</tr>
				<tr>
					<td align="center">请选择发布范围：</td>
					<td colspan="6"><select name="launch_scope">
							<option value="计算机科学与技术学院">计算机科学与技术学院</option>
							<option value="经济与管理学院">经济与管理学院</option>
							<option value="外语学院">外语学院</option>
							<option value="数理学院">数理学院</option>
							<option value="电气工程学院">电气工程学院</option>
							<option value="自动化学院">自动化学院</option>
							<option value="电信学院">电信学院</option>
							<option value="国际交流学院">国际交流学院</option>
					</select></td>
				</tr>
				<tr>
					<td align="center" colspan="7"><input type="submit" value="发布"></td>
				</tr>
			</table>
		</form>
		<table class="dataintable">
			<tr>
				<td align="center">任务ID</td>
				<td align="center">任务名称</td>
				<td align="center">任务内容</td>
				<td align="center">开始时间</td>
				<td align="center">结束时间</td>
				<td align="center">发布者ID</td>
				<td align="center">发布者姓名</td>
				<td align="center">发布范围</td>
				<td align="center" colspan="2">操作</td>
			</tr>
			<%
				for (Task tk : task_list) {
					System.out.println(tk.toString());
			%>
			<tr>
				<td><input type="text" name="tk_taskId"
					value=<%=tk.getTask_id()%> readonly></td>
				<td><input type="text" name="tk_taskName"
					value=<%=tk.getTask_name()%> readonly></td>
				<td><textarea name="taskContent" rows="6" cols="50"
					readonly><%=tk.getTask_content()%></textarea></td>
				<td><input type="text" name="tk_startTime"
					value=<%=tk.getStartTime()%> readonly></td>
				<td><input type="text" name="tk_endTime"
					value=<%=tk.getEndTime()%> readonly></td>
				<td><input type="text" name="tk_launcherID"
					value=<%=tk.getLauncher_id()%> readonly></td>
				<td><input type="text" name="tk_launcherName"
					value=<%=tk.getLauncher_name()%> readonly></td>
				<td><input type="text" name="tk_launchScope"
					value=<%=tk.getLaunch_scope()%> readonly></td>
				<td><%-- <a
					href="../../TaskControl/deleteLaunchedTask/<%=tk.getTask_id()%>"
					style="text-decoration: none">删除</a> --%>
					<form action="../../TaskControl/deleteLaunchedTask" method="post" name="delete_form">
					<input type="hidden" value=<%=tk.getLauncher_id() %> name="launcher_id"/>
					<input type="hidden" value=<%=tk.getTask_id() %> name="task_id"/>
					<td align="center"><input type="submit" value="删除"></td>
					</form>
					</td>
			</tr>
			<%
				}
			%>
		</table>

	</div>
</body>
</html>